/**
 * 接口响应
 */
export interface CasResult<T> {
  /**
   * 结果码
   */
  status: number;
  /**
   * 提示信息(后端定义)
   */
  msg: string;
  data: T;
}

export interface RocketApiResult<T> {
  action: string;
  code: string;
  status: string;
  msg: string;
  data: T;
}

// 列表分页
export interface ListPage<T> {
  content: T[];
  pageable: {
    sort: {
      sorted: boolean;
      unsorted: boolean;
      empty: boolean;
    };
    pageNumber: number;
    pageSize: number;
    offset: number;
    paged: boolean;
    unpaged: boolean;
  };
  totalElements: number;
  totalPages: number;
  last: boolean;
  sort: {
    sorted: boolean;
    unsorted: boolean;
    empty: boolean;
  };
  numberOfElements: number;
  first: boolean;
  size: number;
  number: number;
  empty: boolean;
}

/**
 * 登录响应
 */
export interface CasLoginResponse {
  id: string;
  username: string;
  nickname: string;
  phone: string;
  email: string;
  status: number;
  orgId: string;
  orgName: string;
  face: string;
  createdTime: number;
  uniqueToken: string;
  webServerRedirectUri: string;
  permissions: {
    id: string;
    pid: string;
    type: number;
    name: string;
    code: string;
    description: string;
    uri: string;
    icon: string;
    highIcon: string;
    seq: number;
  }[];
  roles: {
    id: string;
    name: string;
    code: string;
  }[];
}

export interface OrganizationItem {
  id: string;
  name: string;
  code: string;
  description: string | null;
  level: number;
  pid: string;
  status: number;
  display: number;
  createdTime: number;
  updatedTime: number;
  emergency: number;
  children?: OrganizationItem[];
}

export interface RoleItem {
  id: string;
  name: string;
  code: string;
  description: string;
  status: number;
  createdTime: number;
  updatedTime: number;
}

export interface PermissionItem {
  id: string;
  pid: string;
  type: number;
  name: string;
  code: string;
  description: string;
  uri: string;
  icon: string;
  highIcon: string;
  seq: number;
  children: PermissionItem[];
}

export interface UserItem {
  id: string;
  username: string;
  nickname: string;
  phone: string;
  email: string;
  status: number;
  orgId: string;
  orgName: string;
  face: string;
  createdTime: number;
  uniqueToken: string | null;
  webServerRedirectUri: string | null;
  permissions: PermissionItem[];
  roles: RoleItem[];
}

// 敏感词
export interface SensitiveWordItem {
  id: string;
  word: string;
  createdTime: string;
  updatedTime: string;
}

// 签名
export interface SignatureItem {
  id: string;
  name: string;
  certificatePath: string;
  status: string;
  type: string;
  organizationId: string;
  description: string;
  idCardFrontImagePath: string;
  idCardBackImagePath: string;
  powerOfLetter: string;
  phone: string;
  powerOfAttorney: string;
  remark: string;
  createdAt: number;
  updatedAt: number;
}

export interface CallSignatureItem {
  id: string;
  name: string;
  organization: string;
  scriptScenario: string;
  status: string;
  concurrency: number;
  securityCommitment: string;
  remark: string;
  createdAt: number;
  updatedAt: number;
}

// 模版
export interface TemplateItem {
  id: string;
  name: string;
  type: string;
  content: string;
  scenario: string;
  organizationId: string;
  signatureId: string;
  status: string;
  materials: string;
  createdAt: number;
  updatedAt: number;
  applyName: string;
  ctFileUrl: string;
  cuFileUrl: string;
}

// 能力
export interface AbilityItem {
  id: string;
  type: string;
  quantity: number;
  unit: string;
  org: string;
  year: string;
  materials: string;
  scenario: string;
  status: string;
  threshold: number;
  applyTime: number;
  auditTime: number | null;
  updateTime: number;
  remark: string | null;
}

// API Token
export interface ApiTokenItem {
  id: string;
  name: string;
  org: string;
  description: string;
  userId: string;
  expireTime: number;
  createTime: number;
  createBy: string | null;
  lastAccessTime: string | null;
  enabled: boolean;
  token: string;
}

export interface OperationLogItem {
  operModule: string;
  operUser: string;
  operIp: string;
  operTime: string;
  costTime: string;
  operDesc: string;
}

export interface IndustrySmsStatisticsItem {
  time: string;
  totalSent: number;
  successfulSend: number;
  failedSend: number;
  sentWithoutReceipt: number;
  successRate: string;
}

export interface IntelligentCallStatisticsItem {
  time: string;
  callVolume: number;
  connectedVolume: number;
  connectionRate: string;
  totalCallDuration: number;
  averageCallDuration: number;
}

export interface BillingStatisticsItem {
  time: string;
  industrySmsCount: number;
  industrySmsCost: number;
  targetedSmsCount: number;
  targetedSmsCost: number;
  intelligentCallDuration: number;
  intelligentCallCost: number;
}

export interface MessagesItem {
  id: string;
  title: string;
  content: string;
  userId: string;
  isRead: boolean;
  createTime: number;
  readTime: number | null;
  business: string | null;
}
